/* 画廊样式 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    align-items: start; /* 新增 */
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1rem;
}

.gallery-item:hover .overlay {
    opacity: 0.9;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .timeline::after {
        left: 20px;
    }

    .timeline-item {
        width: auto;
        margin-left: 35px !important;
        left: 0 !important;
    }

    .timeline-item::before {
        left: -32px;
        right: auto;
    }
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 新增 */
    border-radius: 8px;
}

/* 添加canvas基础样式 */
.gallery-item painting canvas {
    display: block; /* 消除默认内边距 */
    box-sizing: border-box;
    width: 100% !important; /* 优先使用容器宽度 */
    height: auto !important;
    border: 2px solid #ddd;
    background: #ab6f6f;
}